#ifndef __SYSTEM_H
#define __SYSTEM_H



#define DEBUG 1

#if DEBUG
#define YC_ASSERT(x)	while(!(x))
#define LOG(x) 		do{LOG_PutChar(x);}while(0)
#define LOGS(x,l) 		do{LOG_PutStr(x,l);}while(0)
#else
#define YC_ASSERT(x)
#define LOG(x) 
#define LOGS(x,l) 
#endif


//System power on flag.
#define SYS_POWER_ON_LPM_TIMEUP  0
#define SYS_POWER_ON_CODE_WAKE   1
#define SYS_POWER_ON_LPM_IOWAKE  2



//LOG Port configration parameters, baudrate = 38400
#define IO_UART_PIN_GROUP	GPIO_Pin_0_7_Group
#define IO_UART_PIN			GPIO_Pin_2
#define IO_UART_SET()			REG8(ADDR_REG_GPIO_OUT0+GPIO_Pin_0_7_Group) |= GPIO_Pin_2
#define IO_UART_CLR()			REG8(ADDR_REG_GPIO_OUT0+GPIO_Pin_0_7_Group) &= ~GPIO_Pin_2
#define IO_UART_DELAY		13

#define LPM_DISABLE    0
#define LPM_ENABLE     1
#define TX_POWER_0DBM 0
#define TX_POWER_3DBM 1
#define TX_POWER_5DBM 2
#define TX_POWER_f3DBM 3
#define TX_POWER_f5DBM 4



#define SYS_GetPowerOnFlag() (REG8(mem_module_initialization_state))
void LOG_PutChar(u8_t c);
void LOG_PutStr(u8_t* pstr, u8_t len);
void SYS_Init(void);
bool SYS_CheckWake(void);
void SYS_EnterLpm(void);

#endif

